feat: debugger hot restart#318
Conversation
|
Forgive me because I have been spending the last week wrapping my head around the design with the multiple internal lua-debug VMs, and what runs where and how VMs communicate. Considering your comment I have done another review. Allow me to describe what I have understood, in my own words. At the very least this description may help others understand this project better. Host (debuggee) application uses own helper script to locate Host application then calls require("<helper script>"):start('127.0.0.1:12306')The above forwards the call to Bootstrap code is then run in this new "internal" luadebug VM and becomes the first worker. The first worker creates a new "thread", called the Even though the first worker created the master, its associated host (user's) Lua VM can be debugged also. All workers interact with the "other side" of Once the master is up and running, further unrelated VMs in the same process can require("<helper script>"):attach({})Given the above, I have reconsidered my proposed changes and now in my code I instantiate a dummy Lua VM which just calls With the changes in this PR, any game-related VM can Therefore, I dropped some of the changes but kept part of the modifications that perform orderly cleanup and allow to enter or exit the debugging state, this is very useful. Thanks, |
This PR introduces hot restart so the debugger can be completely turned off and turned on back again, which is useful in server scenarios where you want to enable debugging, enter, look at what is going on and then leave things running as before.
There is a new debugger method
stop()that will shut down the debugger cleanly. The debugger can then be started again withstart().In the case where the host process is running multiple Lua VMs simultaneously, the
DebugMasteracquires a unique key so there may be multiple instances running simultaneously without conflict.Additionally, worker/master channels are cleaned up when a debug session is shut down.